<template>
  <div class="box">
    <ul>
      <li>
        <Icon type="log-in" size=20px color="#000"></Icon>
        <h2>欢迎登录</h2>
      </li>
      <li>
        <Form ref="formInline" :model="formInline" :rules="ruleInline" inline:true>
          <FormItem prop="user">
            <Input type="text" v-model="formInline.user" placeholder="请输入登录账号">
            <Icon type="person" slot="prepend"></Icon>
            </Input>
          </FormItem>
          <FormItem prop="password">
            <Input type="password" v-model="formInline.password" placeholder="请输入登录密码">
                <Icon type="locked" slot="prepend"></Icon>
            </Input>
        </FormItem>
        <FormItem>
            <Button type="success" long style="color:#fff;background:#3399FF" @click="handleSubmit( 'formInline') ">登录</Button>
        </FormItem>
    </Form>
    </li>
  <li>
    <a href="javascript:;">忘记密码</a>
    <a href="javascript:;">注册</a>
  </li>
</ul>

</div>
</template>

<script>
import axios from 'axios';
  export default {
    data() {
      return {
         formInline: {
                    user: '',
                    password: ''
                },
                ruleInline: {
                    user: [
                        { required: true, message: '请填写您的用户名', trigger: 'blur' }
                    ],
                    password: [
                        { required: true, message: '请填写您的密码', trigger: 'blur' },
                        { type: 'string', min: 6, message: '密码长度不能小于6位', trigger: 'blur' }
                    ]
                }
            }
        },
        methods: {
            handleSubmit(name) {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.$Message.success('Success!');
                    } else {
                        this.$Message.error('Fail!');
                    }
                })
            }
        },
        created(){
          console.log(1);
          axios.post('api/admin/login').then(res=>{
            console.log(res);
          })
           
        }
  };
</script>

<style scoped>
 .box{
   width:100%;
   height:900px;
  background:url(../assets/img/1.jpg) no-repeat;
  background-size: 100% auto;
  padding-top:200px;
 }
 ul{
   width:350px;
   height:300px;
   background:#fff;
   margin:0px auto;
 }
 ul li:nth-child(1){
   padding:15px;
   border-bottom: 1px solid #ccc;
 }
 h2{
   font-size:16px;
   color:#000;
   font-weight: 600;
   display: inline;
 }
 ul li:nth-child(2){
  padding:25px 20px 5px 25px;
 }
 ul li:nth-child(3) a:nth-child(1){
   padding-left:30px;
   color:#585858;
 }
 ul li:nth-child(3) a:nth-child(2){
   padding-left:200px;
   color:#585858;
 }
</style>
